﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Core.Tools.IOC
{
    /// <summary>
    /// 表示类型的生命周期
    /// </summary>
    public enum Lifttime
    {
        /// <summary>
        /// 单例
        /// </summary>
        Singleton,
        Transient,
    }

    /// <summary>
    /// 这个特性去标注一些自定义类型，这些自定义类型将来在启动软件时，利用反射技术去实例化拥有ExposedServiceAttribute特性的类型
    /// </summary>
    [AttributeUsage(AttributeTargets.Class,AllowMultiple =false)]
    public class ExposedServiceAttribute : Attribute
    {
        public Lifttime Lifttime { get; set; }
        public bool AutoInitialize { get; set; }
        public Type[] Types { get; set; }

        public ExposedServiceAttribute(Lifttime lifttime = Lifttime.Transient, params Type[] types)
        {
            Lifttime = lifttime;
            Types = types;
        }
    }
}
